package com.littrabble.sort;

public class Shell {

	public static void sort(int[] data, int n) {

		for (int gap = n / 2; gap >= 1; gap /= 2) {
			for (int i = gap; i < n; i++) {
				int j = i - gap;
				int tmp = data[i];

				while (j >= 0 && tmp < data[j]) {
					data[j + gap] = data[j];
					j -= gap;
				}

				data[j + gap] = tmp;
			}
		}
	}
}
